<template>
  <div id="energyCentreRight2">
    <div class="bg-color-black">
      <div class="d-flex pt-2 pl-2">
        <span style="color:#5cd9e8">
          <icon name="align-left"></icon>
        </span>
        <span class="fs-xl text mx-2">设备用电分析</span>
        <dv-decoration-6 style="width:100px;height:20px;" />
      </div>
      <div style="height:4.2rem;width:3.725rem" >
        <dv-conical-column-chart :config="config" />
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    chartData: {
      type: Object,
      required: true
    }
  },
  data() {
    return {
      config: {
        data: [],
        showValue:true
      }
    };
  },
  components: {  },
  mounted() {},
  methods: {},
  watch: {
    chartData: {
      handler(newData) {
        const devices = newData.device
        const data = []
        for(const device of devices){
          let name = device.name
          name = name.replace('系统','')
          name = name.replace('总','')
          data.push({
            name: name,
            value: Math.abs(device.unitPower)
          })
        }
        this.config =  {
          data: data,
          showValue:true
        }
      },
      immediate: true,
      deep: true
    }
  }
};
</script>

<style lang="scss">
#energyCentreRight2 {
  padding: 0.2rem;
  height: 5rem;
  min-width: 3.125rem;
  border-radius: 0.0625rem;
  .bg-color-black {
    padding: 0.0625rem;
    height: 4.8625rem;
    border-radius: 0.125rem;
  }
  .text {
    color: #c3cbde;
  }
  .body-box {
    border-radius: 0.125rem;
    overflow: hidden;
  }
}
</style>
